﻿namespace WMS6.Web.Inventory
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class InvHoldQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlHoldBy;
        protected DropDownList ddlHoldDate;
        protected DropDownList ddlHoldReasonCode;
        protected DropDownList ddlInvHoldID;
        protected DropDownList ddlIsHold;
        protected DropDownList ddlIsHoldOper;
        protected DropDownList ddlLoc;
        protected DropDownList ddlLot;
        protected DropDownList ddlLpnID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlReleasedBy;
        protected DropDownList ddlSkuID;
        protected HtmlForm F5050;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlImage img2;
        protected Label lblHoldBy;
        protected Label lblHoldDate;
        protected Label lblHoldReasonCode;
        protected Label lblInvHoldID;
        protected Label lblIsHold;
        protected Label lblLoc;
        protected Label lblLot;
        protected Label lblLpnID;
        protected Label lblOwnerID;
        protected Label lblReceiptQuery;
        protected Label lblReleasedBy;
        protected Label lblSkuID;
        protected HtmlLink mycss;
        protected TextBox txtHoldBy;
        protected TextBox txtHoldDate;
        protected TextBox txtHoldDate2;
        protected TextBox txtHoldReasonCode;
        protected TextBox txtInvHoldID;
        protected TextBox txtLoc;
        protected TextBox txtLot;
        protected TextBox txtLpnID;
        protected TextBox txtOwnerID;
        protected TextBox txtReleasedBy;
        protected TextBox txtSkuID;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("InvHoldList.aspx", false);
        }

        private void LoadDDl()
        {
            base.InitQueryDDL(this.ddlInvHoldID, 0);
            base.InitQueryDDL(this.ddlLot, 0);
            base.InitQueryDDL(this.ddlLpnID, 0);
            base.InitQueryDDL(this.ddlLoc, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlSkuID, 0);
            base.InitQueryDDL(this.ddlHoldReasonCode, 0);
            base.InitQueryDDL(this.ddlHoldBy, 0);
            base.InitQueryDDL(this.ddlHoldDate, 1);
            base.InitQueryDDL(this.ddlReleasedBy, 0);
            base.InitIsActiveDDL(this.ddlIsHold, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
            }
        }

        public string HoldBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtHoldBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtHoldBy.Text.Trim(), this.ddlHoldBy.SelectedValue);
                }
                return "";
            }
        }

        public string HoldDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtHoldDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtHoldDate.Text.Trim(), this.ddlHoldDate.SelectedValue, this.txtHoldDate2.Text.Trim(), "HoldDate");
                }
                return "";
            }
        }

        public string HoldReasonCode
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtHoldReasonCode.Text.Trim()))
                {
                    return base.GetParamsString(this.txtHoldReasonCode.Text.Trim(), this.ddlHoldReasonCode.SelectedValue);
                }
                return "";
            }
        }

        public string InvHoldID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtInvHoldID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtInvHoldID.Text.Trim(), this.ddlInvHoldID.SelectedValue);
                }
                return "";
            }
        }

        public string IsHold
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsHold.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsHold.SelectedValue, this.ddlReleasedBy.SelectedValue);
                }
                return "";
            }
        }

        public string Loc
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLoc.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLoc.Text.Trim(), this.ddlLoc.SelectedValue);
                }
                return "";
            }
        }

        public string Lot
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLot.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLot.Text.Trim(), this.ddlLot.SelectedValue);
                }
                return "";
            }
        }

        public string LpnID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtLpnID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtLpnID.Text.Trim(), this.ddlLpnID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string ReleasedBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReleasedBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtReleasedBy.Text.Trim(), this.ddlReleasedBy.SelectedValue);
                }
                return "";
            }
        }

        public string SkuID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtSkuID.Text.Trim(), this.ddlSkuID.SelectedValue);
                }
                return "";
            }
        }
    }
}

